Repository navigation
fix(aws-lambda): pin the shell ZIP route, gate ZIP headroom, match arm64 fonts to x86 - #8170
Conversation
…m64 fonts to x86 - build-zip --source=chrome-headless-shell stages only the repo's pinned build (managedChromeVersion) and only when its folder matches the pinned digest (isPinnedHeadlessShell), instead of the newest folder in the cache. The folder cannot fit a ZIP function, so lambda deploy refuses --chrome-source chrome-headless-shell up front on either arch, and the docs say the arm64 video image is where the shell runs. - build-zip prints the headroom under the unzipped gate, and a new "Lambda handler ZIP" workflow builds the ZIP on PRs that touch the code it bundles, so growth fails before merge rather than in the release job. - The arm64 image keeps @sparticuz/chromium's fonts and fonts.conf from the handler ZIP (FONTCONFIG_PATH=/var/task/fonts) instead of liberation-fonts, so text falls back to the same fonts as on x86. The image workflow renders a mixed-script page on both arches and fails when any line resolves to different platform fonts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 271 (base branch 271), smooth 70 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
miguel-heygen
left a comment
There was a problem hiding this comment.
Reviewed at 6de46be. All three #8155 follow-ups are closed.
Follow-ups
- Closed.
_chromeHeadlessShell.ts:19-41stages onlylinux-${managedChromeVersion("linux")}, andisPinnedHeadlessShell(enginechromeHostCeiling.ts:109-133) hashes every file in the folder, refusing symlinks and non-files. The newest-in-cache pick is gone.lambda deploynow refuses--chrome-source chrome-headless-shellfor every arch before any build or AWS call (deploy.ts). - Closed.
build-ziplogs the headroom.lambda-handler-zip.ymlbuilds the ZIP on PRs touching aws-lambda, the producer/engine/core/parserssrc, orbun.lock. - Closed with a better check than the one we asked for: per-line platform fonts on both arches, diffed in CI. The comparison job's log shows arm64 resolving Open Sans, so the fonts load from
/var/task/fonts.
Rule 7 / runners
New and changed jobs run on ubuntu-latest only (no paid or macOS runners), with SHA-pinned actions and contents: read. The fonts come from the locked sparticuz package, so nothing new is downloaded. setup-bun has no version, the same as the repo's other workflows.
Minor (follow-ups, not blocking)
isPinnedHeadlessShellaccepts any pinned digest, not just this version's. The folder must still be a known pinned build, so the exposure is small.- The excluded
debug.logandchrome_debug.logwould be copied into a ZIP unhashed. Drop them in staging. - The CDK
chromeSourceprop and the SAMChromeSourceparameter only document the limit; they still accept the shell value. The CLI refuses it. - Body: CJK, Arabic and emoji render blank on x86 today, and arm64 now matches. That's consistent, but it's a real gap worth its own issue: no CJK or emoji font on either arch.
Verdict: approve.
Reasoning: each follow-up is fixed in code and checked in CI on the real artifacts. The pinned route can no longer ship an unchecked build, and the remaining items are small, with no unverified binary path.
What
Three follow-ups from the review of #8155:
build-zip --source=chrome-headless-shellstages only the repo's pinned shell build, and only when its folder matches the pinned digest. Before, it staged whatever build was newest in the Puppeteer cache.hyperframes lambda deploynow refuses--chrome-source chrome-headless-shellup front, because the shell can't fit a ZIP function.@sparticuz/chromium's own fonts in place ofliberation-fonts, so text falls back to the same fonts on both arches. CI renders a mixed-script page on both and fails if any line resolves to different fonts.Why
lambda deploy --video-arch x86_64 --chrome-source chrome-headless-shellbuilt the sparticuz ZIP anyway and deployed it pointing at a shell path that doesn't exist.packages/aws-lambdachanges. So growth elsewhere would first fail in the release job.@sparticuz/chromium153 ships only Open Sans plus afonts.confthat scans its own font folders. The x86 function therefore draws every family (sans-serif, serif, monospace) in Open Sans. fix(aws-lambda): chrome-headless-shell 158 in the arm64 video image, sparticuz 153 in the x86 ZIP #8155 gave the arm64 imageliberation-fonts, so the same composition fell back to different fonts depending on--video-arch. Before fix(aws-lambda): chrome-headless-shell 158 in the arm64 video image, sparticuz 153 in the x86 ZIP #8155 the arm64 image also ran sparticuz, with the same Open Sans set.Related work
Follows #8145 and #8155.
How
scripts/_chromeHeadlessShell.ts): it reads the version frommanagedChromeVersion("linux")and checks the folder withisPinnedHeadlessShell, both from@hyperframes/engine/chrome-host-ceiling. That is the same pin and per-file digest the CLI uses for its own browser, sopin:chromekeeps both in step. It also uses Puppeteer's real cache layout (linux-<version>/); the old code and its tests assumed bare version folders.@hyperframes/engineis added as a devDependency for this script.packages/cli/src/commands/lambda/deploy.ts): one check for every arch, before any build or AWS call, naming the arm64 image as where the shell runs. The SAM template, the CDK prop, the CLI docs and the READMEs say the same.build-ziplogsunzipped staging size: X, Y under the limit. The new.github/workflows/lambda-handler-zip.ymlbuilds the ZIP whenpackages/{aws-lambda,producer,engine,core,parsers},bun.lockor the workflow file change. It skips release-only diffs like the other heavy workflows.stage-arm64-image.tsunpacks the handler ZIP's@sparticuz/chromium/bin/fonts.tar.brinto/var/task/fonts, the same layout sparticuz unpacks into/tmp/fonts.FONTCONFIG_PATH=/var/task/fontsand dropsliberation-fonts. The fonts come from the locked sparticuz package, so nothing new is downloaded.image/smoke-video.mjsrenders a page with Latin, serif, monospace, Greek and Cyrillic, CJK, Arabic and emoji lines. It returns each line's platform fonts (CDPCSS.getPlatformFontsForNode) and a screenshot.x86 text renderjob runs it on the unzipped handler ZIP in the same pinnednodejs:22base, with sparticuz.Text fonts match across archesdiffs the two font maps. Both screenshots are uploaded as artifacts.Test plan
build-zipstages only the pinned folder and refuses a cached folder whose digest doesn't match. It names the pinned install command when only another version is cached.stage-arm64-imagekeeps the fonts and drops the x86 Chrome. CLIlambda deployrefuses the shell onarm64,x86_64and the default arch.@hyperframes/aws-lambdascripts: 7 pass. CLIsrc/commands/lambda: 105 pass.scripts/ci/release-only-diff,publish-workflowandcheck-test-reachability: 70 pass.@puppeteer/browserspasses the digest check and stages 295,609,238 bytes. Its files match a folder unzipped from Chrome for Testing's own linux64 archive, byte for byte.build:zipon this branch:246.5 MiB, 1.5 MiB under the limit.nodejs:22amd64 base under the Lambda runtime: Chrome 153.0.8010.0, and every line resolves to Open Sans only. CJK, Arabic and emoji render blank on x86 today.Lambda arm64 imageand the newText fonts match across archesandLambda handler ZIPchecks. On arm64 (Chrome 158.0.8127.36) every line of the text page resolves to Open Sans with the same glyph counts as on x86.🤖 Generated with Claude Code